In [1]:
import DSP
using PyPlot

In [2]:
# include all modules in juwvid
include("../juwvid.jl")
include("../smethod.jl")
include("../stokes.jl")


WARNING: replacing module smethod
WARNING: replacing module stokes
Out[2]:
stokes

Generating a multi-polarized signal


In [4]:
n=512
t=linspace(0,10,n)
a=0.5
b=1.0
insf=a*t+b;
insf2=9.0+0.0*t;
insf3=20.0-a*t;


y1=gensample.genfmfunc(t,insf)+0.5*gensample.genfmfunc(t,insf2)+0.7*gensample.genfmfunc(t,insf3)
y2=gensample.genfmfunc(t,insf,pi/2.0)+0.7*gensample.genfmfunc(t,insf3)
fig=PyPlot.figure()
ax = Axes3D(fig) 
PyPlot.plot(t,y1,y2,".",alpha=0.7)
PyPlot.plot(t,y1,y2,color="green",alpha=0.3)
PyPlot.savefig("input.png")



In [5]:
fig=PyPlot.figure(figsize=(15,4))
#ax = fig[:add_subplot](2,1,1)
PyPlot.plot(t,y1,color="green",alpha=0.7)
#ax = fig[:add_subplot](2,1,2)
PyPlot.plot(t,y2,color="red",alpha=0.7)
PyPlot.savefig("input.png")


Spectrogram Stokes Distribution


In [6]:
I,Q,U,V=stokes.spstokes(y1,y2);


Use fft.
Use fft.

In [7]:
fig=PyPlot.figure()
ax = fig[:add_subplot](2,2,1)
a=juwplot.wtfrshow((I),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap")
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.ylabel("frequency")
PyPlot.title("I")
ax = fig[:add_subplot](2,2,2)
a=juwplot.wtfrshow((Q),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap")
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.title("Q")
ax = fig[:add_subplot](2,2,3)
a=juwplot.wtfrshow((U),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap")
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.ylabel("frequency")
PyPlot.xlabel("time")
PyPlot.title("U")
ax = fig[:add_subplot](2,2,4)
a=juwplot.wtfrshow((V),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap")
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.xlabel("time")
PyPlot.title("V")


Out[7]:
PyObject Text(0.5,1,'V')

Wigner-Stokes Distribution


In [8]:
I,Q,U,V=stokes.wvstokes(y1,y2);


Single Wigner Ville
Use fft.
Single Wigner Ville
Use fft.
Cross Wigner Ville
Use fft.
Cross Wigner Ville
Use fft.

In [9]:
fig=PyPlot.figure()
ax = fig[:add_subplot](2,2,1)
a=juwplot.tfrshow((I),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap")
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.ylabel("frequency")
PyPlot.title("I")
ax = fig[:add_subplot](2,2,2)
a=juwplot.tfrshow((Q),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap")
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.title("Q")
ax = fig[:add_subplot](2,2,3)
a=juwplot.tfrshow((U),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap")
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.ylabel("frequency")
PyPlot.xlabel("time")
PyPlot.title("U")
ax = fig[:add_subplot](2,2,4)
a=juwplot.tfrshow((V),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap")
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.xlabel("time")
PyPlot.title("V")


Out[9]:
PyObject Text(0.5,1,'V')

Pseudo Wigner-Stokes Distribution


In [10]:
Ip,Qp,Up,Vp=stokes.pwvstokes(y1,y2);


Single pseudo Wigner Ville
Use fft.
Single pseudo Wigner Ville
Use fft.
Cross pseudo Wigner Ville
Use fft.
Cross pseudo Wigner Ville
Use fft.

In [11]:
fig=PyPlot.figure()
ax = fig[:add_subplot](2,2,1)
a=juwplot.tfrshow((Ip),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap")
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.ylabel("frequency")
PyPlot.title("I")
ax = fig[:add_subplot](2,2,2)
a=juwplot.tfrshow((Qp),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap")
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.title("Q")
ax = fig[:add_subplot](2,2,3)
a=juwplot.tfrshow((Up),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap")
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.ylabel("frequency")
PyPlot.xlabel("time")
PyPlot.title("U")
ax = fig[:add_subplot](2,2,4)
a=juwplot.tfrshow((Vp),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap")
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.xlabel("time")
PyPlot.title("V")


Out[11]:
PyObject Text(0.5,1,'V')

S-Stokes Distribution


In [12]:
Is,Qs,Us,Vs=stokes.smstokes(y1,y2);


Single S-method
Use fft.
Single S-method
Use fft.
Cross S-method
Use fft.
Use fft.
Cross S-method
Use fft.
Use fft.

In [13]:
#USE different definition (see Hayama+2016)
#yR=(y1 - y2*im)/sqrt(2);
#yL=(y1 + y2*im)/sqrt(2);
#Is,Qs,Us,Vs=stokes.smstokes(yR,yL,6,NaN,0,4,NaN,NaN,NaN,"st");

In [14]:
fig=PyPlot.figure()
ax = fig[:add_subplot](2,2,1)
a=juwplot.wtfrshow((Is),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap",0,200)
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.ylabel("frequency")
PyPlot.title("I")
ax = fig[:add_subplot](2,2,2)
a=juwplot.wtfrshow((Qs),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap",0,200)
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.title("Q")
ax = fig[:add_subplot](2,2,3)
a=juwplot.wtfrshow((Us),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap",0,200)
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.ylabel("frequency")
PyPlot.xlabel("time")
PyPlot.title("U")
ax = fig[:add_subplot](2,2,4)
a=juwplot.wtfrshow((Vs),t[2]-t[1],t[1],t[end],NaN,NaN,0.7,"CMRmap",0,200)
PyPlot.colorbar(a,shrink=0.5)
PyPlot.ylim(0,25)
PyPlot.xlabel("time")
PyPlot.title("V")


Out[14]:
PyObject Text(0.5,1,'V')

In [ ]: